using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Threading;

namespace smartBrowser.Task.Annotators
{
    public abstract class AbstractAnnotator
    {
        public virtual bool URLMatches(string url)
        {
            return false;
        }

        public void CreateTooltip(HtmlElement link, HtmlDocument document, string linkId)
        {
            WaitCallback callback = new WaitCallback(ThreadPoolCallback);
            ThreadPool.QueueUserWorkItem(callback, new object[] { link, document, linkId });
        }

        private void ThreadPoolCallback(Object threadContext)
        {
            HtmlElement link = (HtmlElement)((object[]) threadContext)[0];
            HtmlDocument document = (HtmlDocument)((object[])threadContext)[1];
            string linkId = (string)((object[])threadContext)[2];

            CreateTooltipThread(link, document, linkId);
        }

        protected virtual void CreateTooltipThread(HtmlElement link, HtmlDocument document, string linkId)
        {
        }
    }
}
